#include<bits/stdc++.h>

using namespace std;

#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);


    int x;
    string s;
    while (cin >> s) {
        for (char ch:s) {
            string s(1, ch);
            istringstream iss(s);
            int x;
            iss >> hex >> x;

            int a = (x / 8), b = (x % 8 / 4), c = x % 4 / 2, d = x % 2;
            cout << a << b << c << d;
        }
        cout << endl;

    }

    return 0;
}
